﻿<UserControl x:Class="MetroDemo.ExampleViews.ColorExample"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:MetroDemo="clr-namespace:MetroDemo"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:behaviours="http://metro.mahapps.com/winfx/xaml/shared"
             mc:Ignorable="d"
             d:DesignHeight="600"
             d:DesignWidth="800"
             d:DataContext="{d:DesignInstance MetroDemo:MainWindowViewModel}">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro.Resources;component/Icons.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <ScrollViewer>
        <ItemsControl ItemsSource="{Binding BrushResources}"
                      Grid.IsSharedSizeScope="True">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Grid ToolTip="{Binding}"
                          MinHeight="40"
                          Margin="5">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition SharedSizeGroup="color" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Ellipse Stroke="#bdbdbd"
                                 Height="80"
                                 Width="80"
                                 Grid.Row="0">
                            <i:Interaction.Behaviors>
                                <behaviours:BindableResourceBehavior ResourceName="{Binding}"
                                                                     Property="{x:Static Shape.FillProperty}" />
                            </i:Interaction.Behaviors>
                        </Ellipse>
                        <TextBlock Grid.Row="1"
                                   Margin="4,2,4,10"
                                   FontSize="{DynamicResource NormalFontSize}"
                                   TextAlignment="Center"
                                   Text="{Binding}" />
                    </Grid>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </ScrollViewer>

</UserControl>
